﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="News.aspx.vb" Inherits="AssignmentProject.News" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
 <script type="text/javascript">
     $(document).ready(function () {
         $("#Button2").toggle(
       function () {
           $("#container").slideDown(300);

       },
       function () {
           $("#container").fadeOut(600);

       }
       );
     });
    </script>
<style type="text/css">
    #container
    {
        position:absolute;
        left: 35%;
        width: 400px;
        
    }
    .container{width:800px;}
    .togglable{display:none;width: 400px;margin:0 auto;}
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
   <h1>Welcome to the Gobblz News Feed</h1>

   <h3>Here you can find news on events in your area, as well as hints and advice from other users.</h3>

   <h4>Be sure to visit regularly and don't forget to subscribe to our RSS feed so that all of the latest
   recipes and news stories can be sent to you automatically - it's so easy!</h4>
       <div class="container">



        <br />
        <asp:Label ID="Label1" runat="server" Text="Comment Title"></asp:Label>
        <br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server" Height="93px" Width="357px"></asp:TextBox>
        <br />
        <br />
        <br />



        <asp:Button ID="Button1" runat="server" Text="Add Your Comment" />

    </div>






    <p>
        <asp:Button ID="Button2" runat="server" Text="Hide/Show Story & Comments" ClientIDMode="Static" />
    </p>
    <p>&nbsp;</p>
    <div id="container" class="togglable"> 
        &nbsp;&nbsp;&nbsp;<asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
            OnItemDataBound ="doBinding" >
            <AlternatingItemTemplate>
            <hr />
                <h3><asp:Label ID="TitleLabel" runat="server" Text= '<%# Eval("Title") %>' /></h3>
                <br />
                <asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>' />
                <br />
                Submitted by:<asp:Label ID="SubmittedLabel" runat="server" Text='<%# Eval("Submitted") %>' />
                <br />
                <asp:Label ID="SubmissionDateLabel" runat="server" 
                    Text='<%# Eval("SubmissionDate") %>' />
                <br />
                
<br /><hr /></span>
                <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate>
                <h2><%# Eval("commentMadeTitle")%></h2>
                <p><%# Eval("commentMade")%></p>
                </ItemTemplate>
                </asp:Repeater>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <span style="">ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                Title:
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />
                Story:
                <asp:TextBox ID="StoryTextBox" runat="server" Text='<%# Bind("Story") %>' />
                <br />
                Submitted:
                <asp:TextBox ID="SubmittedTextBox" runat="server" 
                    Text='<%# Bind("Submitted") %>' />
                <br />
                SubmissionDate:
                <asp:TextBox ID="SubmissionDateTextBox" runat="server" 
                    Text='<%# Bind("SubmissionDate") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br /><br /></span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style="">Title:
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />Story:
                <asp:TextBox ID="StoryTextBox" runat="server" Text='<%# Bind("Story") %>' />
                <br />Submitted:
                <asp:TextBox ID="SubmittedTextBox" runat="server" 
                    Text='<%# Bind("Submitted") %>' />
                <br />SubmissionDate:
                <asp:TextBox ID="SubmissionDateTextBox" runat="server" 
                    Text='<%# Bind("SubmissionDate") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br /><br /></span>
            </InsertItemTemplate>
            <ItemTemplate>
            <hr />
                
               <h3><asp:Label ID="TitleLabel" runat="server" 
                    Text='<%# Eval("Title") %>'></asp:Label></h3>
                <br />
                <asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>'></asp:Label>
                <br />
                Submitted By:<asp:Label ID="SubmittedLabel" runat="server" 
                    Text='<%# Eval("Submitted") %>'></asp:Label>
                <br />
                <asp:Label ID="SubmissionDateLabel" runat="server" 
                    Text='<%# Eval("SubmissionDate") %>'></asp:Label>
                <br />
                <br />
                <hr />
                </span>
                <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate>
                <h2><%# Eval("commentMadeTitle")%></h2>
                <p><%# Eval("commentMade")%></p>
                </ItemTemplate>
                </asp:Repeater>

            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" style="">
                    <span style="" />
                    <span ID="itemPlaceholder" runat="server"></span>
                </div>
                <div style="">
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="">ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                Title:
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                <br />
                Story:
                <asp:Label ID="StoryLabel" runat="server" Text='<%# Eval("Story") %>' />
                <br />
                Submitted:
                <asp:Label ID="SubmittedLabel" runat="server" Text='<%# Eval("Submitted") %>' />
                <br />
                SubmissionDate:
                <asp:Label ID="SubmissionDateLabel" runat="server" 
                    Text='<%# Eval("SubmissionDate") %>' />
                <br />
<br /></span>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT [ID], [Title], [Story], [Submitted], [SubmissionDate] FROM [NewsItems] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="{0}" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
&nbsp;&nbsp;&nbsp;
        
    </div>

    <p>&nbsp;</p>


</asp:Content>
